//
//  HMStatusRetweetView.swift
//  微博
//
//  Created by 郭鉴增 on 2016/12/10.
//  Copyright © 2016年 郭鉴增. All rights reserved.
//

import UIKit

//转发微博视图
class HMStatusRetweetView: UIView {

    //需要视图模型
    var statusViewModel: HMStatusViewModel? {
        didSet {
            //绑定转发微博数据
            contentLabel.text = statusViewModel?.retweetContent
        }
    }
    
    //MARK: - 懒加载
    private lazy var contentLabel: UILabel = {
        let label = UILabel(fontSize: 14, textColor: UIColor.gray)
        
        //多行显示
        label.numberOfLines = 0
        
        
        return label
    }()
    
    override init(frame: CGRect) {
        super.init(frame: frame)
        setupUI()
    }
    
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    //添加控件设置约束
    private func setupUI() {
        backgroundColor = UIColor(white: 0.95, alpha:1)
        
        addSubview(contentLabel)
        contentLabel.snp_makeConstraints { (make) in
            make.top.equalTo(self).offset(StatusItemMargin)
            make.leading.equalTo(self).offset(StatusItemMargin)
            make.width.equalTo(ScreenWidth - 2 * StatusItemMargin)
        }
        //关键约束  (当前视图的地步等于内容的底部约束加上一个间距)
        self.snp_makeConstraints { (make) in
            make.bottom.equalTo(contentLabel).offset(StatusItemMargin)
        }
        
    }

}
